//
//  NetWorkingManager.m
//  绿地管理系统
//
//  Created by rimi on 16/1/20.
//  Copyright © 2016年 hexs. All rights reserved.
//

#import "NetWorkingManager.h"

@implementation NetWorkingManager

+ (void)postWithUrl:(NSString *)url
             params:(NSDictionary *)params
     successHandler:(SuccessBlock)success
     failureHandler:(FailureBlock)failure
{
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    [manager POST:url parameters:params success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {
        if (success) {
            success(responseObject);
        }
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        if (failure) {
            failure(error);
        }
    }];
}

+ (NSDictionary *)paramsByAppendingBaseParams:(NSDictionary *)params module:(NSString *)module
{
    NSMutableDictionary *retParams = [params mutableCopy];
    retParams[@"g"] = @"ApiGGC";
    retParams[@"m"] = module;
    return retParams;
}

@end
